<template>
    <div>
        <van-nav-bar title="欢迎搜索" />
        <van-search v-model="value" shape="round" placeholder="请输入搜索关键词" />
        <van-empty v-if="goods.length == 0" image="https://fastly.jsdelivr.net/npm/@vant/assets/custom-empty-image.png"
            image-size="80" description="描述文字" />

        <van-cell-group v-for="item in goods">
            <router-link :to="'/home/xq/' + goods_id"><van-cell :title="item.goods_name" /></router-link>
        </van-cell-group>

    </div>
</template>

<script setup>
import { ref } from 'vue'
import { watch } from 'vue'
import { goodsApi } from '@/api/api'
let value = ref('')
let goods = ref([])
watch(value, (item) => {
    goodsApi(item).then(res => {
        console.log('搜索数据', res)
        goods.value = res.data.message
    })
})

</script>

<style lang="scss" scoped></style>